package reflection;

/**
 * @author 小小唐
 * @Date 2022/8/28-星期日-12:13
 *
 */
public class Demo4 {
    public static void main(String[] args) {
        A a = new A();
//        System.out.println(a);
        System.out.println(A.m);

        /*
        1、加载到内存，产生一个类对应的class对象
        2、链接，链接结束后 m = 0
        3、初始化
               <clinit>(){
                System.out.println("初始化数值");
                m = 300;
                m = 100;
        }

          最终 m = 100;
         */
    }
}

class A{
     static {
         System.out.println("A类静态代码块初始化");
         m = 300;
     }

     /*
     m = 300
     m = 100
      */

     static int m = 100;

     public A(){
         System.out.println("A类的无参构造初始化");
     }
}
